package com.dyh.quickdemo.bizDemo.tryClose;

import java.util.function.Supplier;

/*
@Author=Joey Wheeler
@Date=2021/3/10 11:13
*/
public class MyAutoClose implements AutoCloseable, Supplier<String> {

    Supplier<String> supplier;

    public MyAutoClose() {

    }


    public MyAutoClose(Supplier<String> supplier) {
        this.supplier = supplier;
    }

    @Override
    public void close() throws Exception {
        System.out.println("MyAutoClose.close");
    }

    @Override
    public String get() {
        return supplier.get();
    }
}
